package com.huonan.service.itemservice.controller;

import com.huonan.service.itemservice.domain.Item;
import com.huonan.service.itemservice.service.ItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author huonan
 * @date 2020/2/27 16:58
 * @desc
 */
@RestController
@RefreshScope
public class ItemController {
    @Autowired
    private ItemService itemService;

    @GetMapping("/item/{id}")
    public Item getItem(@PathVariable("id") int id) {
        return itemService.queryItemById(id);
    }

//    @Value("${hello.text}")
//    private String text;
//
//    @GetMapping("/say")
//    public String sayHello() {
//        return text;
//    }


    @Value("${didispace.title:}")
    private String title;

    @GetMapping("/testNacos")
    public String testNacos() {
        return title;
    }
}
